package com.epoint.mobileoa.personalized.epointcompany.ui;

import java.util.List;

import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

import com.epoint.mobileoa.R;
import com.epoint.mobileoa.bizlogic.SuperView;
import com.epoint.mobileoa.bizlogic.Task;
import com.epoint.mobileoa.personalized.epointcompany.adapter.MissionInfoAdapter;
import com.epoint.mobileoa.personalized.epointcompany.bizlogic.BindMissionInfoTask;
import com.epoint.mobileoa.personalized.epointcompany.model.MissionInfoModel;
import com.epoint.mobileoa.service.MainService;

/**
 * @author liyc
 * @time 2012-4-5 上午11:23:23
 * @annotation 新增工作内容
 */
public class AddNewWorkContentViewMission extends SuperView {

	private ListView lvMyMission;
	public static MissionInfoModel choose_mim;

	@Override
	public void initControls() {
		lvMyMission = (ListView) findViewById(R.id.lv_mymission);
		lvMyMission.setOnItemClickListener(this);
		showRightProgressBar();

		Task task= new BindMissionInfoTask(this, null);
		MainService.addTask(task);

	}

	private List<MissionInfoModel> list;

	@Override
	public void refresh(Object... param) {
		if(param[0].toString().equals(MainService.NORMAL)){
			String bs = param[1].toString();
			list = BindMissionInfoTask.XmlAnalysis(bs);
			MissionInfoAdapter adapter = new MissionInfoAdapter(this, list);
			lvMyMission.setAdapter(adapter);
		}
		top_pb.setVisibility(View.INVISIBLE);
	}

	@Override
	public int getLayoutInt() {
		return R.layout.epoint_addnewworkcontentviewmission;
	}

	@Override
	public String setTitle() {
		return "任务选择";
	}
	
	@Override
	public void onItemClick(AdapterView<?> parent, View view,
			int position, long id) {
		choose_mim = list.get(position);
		finish();
	}

	@Override
	public void refreshForNewTask(int TaskId,Object... param){
	}

}
